<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
    
    $dsn = 'mysql:dbname=unidu_rezervacija;host=localhost;port=3306;charset=utf8';
    try {
      $dbh = new PDO($dsn, 'root', '');
    }
    catch (PDOException $e) {
      die('Konekcija neuspješna: ' . $e->getMessage(  ));
    }
    
   
if (true) {
    $upit_s_izlazom = 'CALL unidu_rezervacija.vozilo_ui(NULL,:p_in_opis,NULL,:p_in_status,:p_in_biljeske,@status)';
    $sth=$dbh->prepare($upit_s_izlazom);
    if ($dbh->errorCode() <> '00000') {
      die("Error: ".implode(': ',$dbh->errorInfo(  ))."\n");
    }
   
    $p_in_opis = 'Caddy';
    $p_in_status = 'N';
	$p_in_biljeske = 'Kupljeno povoljnim kreditom od poduzeća Klas.';   
    $p_out_status = '';
   
    $sth->bindParam(':p_in_opis', $p_in_opis, PDO::PARAM_STR, 50);
    $sth->bindParam(':p_in_status', $p_in_status, PDO::PARAM_STR, 50);
	$sth->bindParam(':p_in_biljeske', $p_in_biljeske, PDO::PARAM_STR, 50);
    //$sth->bindParam(':p_out_status', $p_out_status, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 50);
    $sth->execute();
    $sql_get_status='SELECT @status';
    $sth = $dbh->query($sql_get_status);
    $row=$sth->fetch();
    printf("Status = %s <br />", $row['@status']);
}
 
    $dbh = null;         // zatvaranje konekcije!
?>


</body>
</html>